home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / appsrcs.zip / APPSETUP.ZIP / APPSHELL.C < prev    next >
C/C++ Source or Header  |  1993-06-04  |  3KB  |  108 lines

  1. #define STRICT
  2. #include <windows.h>
  3. #include <windowsx.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <string.h>
  7. #include "appsetup.h"
  8.  
  9. BOOL bAlreadyShell;
  10. char run[256], load[256];
  11.  
  12. /*-------------------------------------------------------------------------*/
  13. BOOL WINAPI ShellDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  14.     {
  15.     static DLGPROC   lpfnSaveDlgProc;
  16.     char         szGroupFiles[8*MAXFILECHARS];
  17.     BOOL         bSigned = TRUE;
  18.  
  19.     switch(message)
  20.     {
  21.     case WM_INITDIALOG:
  22.         AppSystemNew = AppSystem;
  23.         ReadRunLoadIni((LPSTR) run, (LPSTR) load);
  24.         SetDlgItemText(hDlg, IDSHL_LOAD, load);
  25.         SetDlgItemText(hDlg, IDSHL_RUN, run);
  26.         SetDlgItemText(hDlg, IDSHL_SHELLGROUP, AppSystemNew.ShellGroup);
  27.         if(IsAppBarShell())
  28.         {
  29.         bAlreadyShell = TRUE;
  30.         CheckDlgButton(hDlg, IDSHL_SHELL, TRUE);
  31.         }
  32.         else
  33.         bAlreadyShell = FALSE;
  34.         return TRUE;
  35.  
  36.     case WM_COMMAND:
  37.         switch(wParam)
  38.         {
  39.         case IDSHL_SHELLGROUP:
  40.             if(HIWORD(lParam) == EN_KILLFOCUS)
  41.             {
  42.             GetDlgItemText(hDlg, IDSHL_SHELLGROUP, AppSystemNew.ShellGroup, 4*MAXFILECHARS-1);
  43.             SetDlgItemText(hDlg, IDSHL_SHELLGROUP, AppSystemNew.ShellGroup);
  44.             }
  45.             return TRUE;
  46.  
  47.         case IDSHL_LOAD:
  48.             if(HIWORD(lParam) == EN_KILLFOCUS)
  49.             {
  50.             GetDlgItemText(hDlg, IDSHL_LOAD, load, 255);
  51.             SetDlgItemText(hDlg, IDSHL_LOAD, load);
  52.             }
  53.             return TRUE;
  54.  
  55.         case IDSHL_RUN:
  56.             if(HIWORD(lParam) == EN_KILLFOCUS)
  57.             {
  58.             GetDlgItemText(hDlg, IDSHL_RUN, run, 255);
  59.             SetDlgItemText(hDlg, IDSHL_RUN, run);
  60.             }
  61.             return TRUE;
  62.  
  63.         case IDSHL_SHELL:
  64.             CheckDlgButton(hDlg, IDSHL_SHELL, !IsDlgButtonChecked(hDlg, IDSHL_SHELL));
  65.             return TRUE;
  66.  
  67.         case IDSHL_BROWSE:
  68.             if(BrowseFile(szGroupFiles, hDlg, GROUPFILES))
  69.             {
  70.             strcpy(AppSystemNew.ShellGroup, szGroupFiles);
  71.             SetDlgItemText(hDlg, IDSHL_SHELLGROUP, AppSystemNew.ShellGroup);
  72.             }
  73.             return TRUE;
  74.  
  75.         case IDSHL_DEFAULT:
  76.             strcpy(AppSystemNew.ShellGroup, (LPSTR) SHELLGROUP_DEFAULT);
  77.             SetDlgItemText(hDlg, IDSHL_SHELLGROUP, (LPSTR) SHELLGROUP_DEFAULT);
  78.             return TRUE;
  79.  
  80.         case IDOK:
  81.             if((IsDlgButtonChecked(hDlg, IDSHL_SHELL) && !bAlreadyShell) ||
  82.                (!IsDlgButtonChecked(hDlg, IDSHL_SHELL) && bAlreadyShell))
  83.             {
  84.             lpfnSaveDlgProc = (DLGPROC) MakeProcInstance(SaveDlgProc, hInst);
  85.             DialogBox(hInst, "SaveDlg", hDlg, lpfnSaveDlgProc);
  86.             FreeProcInstance((FARPROC) lpfnSaveDlgProc);
  87.             }
  88.             GetDlgItemText(hDlg, IDSHL_LOAD, load, 255);
  89.             GetDlgItemText(hDlg, IDSHL_RUN, run, 255);
  90.             SaveRunLoadIni((LPSTR) run, (LPSTR) load);
  91.             AppSystem = AppSystemNew;
  92.             bSave = TRUE;
  93.             EndDialog(hDlg, 0);
  94.             return TRUE;
  95.  
  96.         case IDSHL_HELP:
  97.             WinHelp(hWnd, "AppSetup.hlp",HELP_CONTENTS, 0L);
  98.             return TRUE;
  99.  
  100.         case IDCANCEL:
  101.             EndDialog(hDlg, 0);
  102.             return TRUE;
  103.         }
  104.         break;
  105.     }
  106.     return FALSE;
  107.     }
  108.